﻿
function generate_table(col_names, object_props, objects, id) {
    var html_out = '<table id="' + id + '" class="tablesorter rpt_results"><thead>';
    html_out += "<tr class=\"rpt_header\">";
    for (var col_idx = 0; col_idx < col_names.length; col_idx++) {
        html_out += "<th class=\"" + object_props[col_idx] + "_header\">" + col_names[col_idx] + "</th>";
    }
    html_out += "</tr></thead><tbody>";
    for (var obj_idx = 0; obj_idx < objects.length; obj_idx++) {
        curr_obj = objects[obj_idx];
        html_out += "<tr class=\"rpt_detail\">";
        for (var col_idx = 0; col_idx < object_props.length; col_idx++) {
            html_out += "<td class=\"" + object_props[col_idx] + "_detail\">" + curr_obj[object_props[col_idx]] + "</td>";
        }
        html_out += "</tr>";
    }
    html_out += "</tbody></table>";
    return html_out;
}
